package ch.unisi.inf.pfii.teamred.pacman.model;

/**
 * This class describes a ghost in the Pacman game.
 * 
 * @author luca.vignola@lu.unisi.ch
 * @author mark.pruneri@lu.unisi.ch
 * 
 */
public abstract class Ghost extends AiControlledCreature {

	public Ghost(final Position startPosition,
			final Direction currentDirection,
			final GhostController ghostController) {
		super(startPosition, currentDirection, ghostController);
		setInvulnerable();
	}

	private final Direction getNextDirection() {
		return getController().move();
	}

	public final Position getNextPosition() {
		Position position = getCurrentPosition().clone();
		Direction newDirection = getNextDirection();
		position.addToPosition(getRelativePosition(newDirection));
		setCurrentDirection(newDirection);
		return position;
	}

	public final String toString() {
		return "G";
	}

}
